import java.util.Scanner;

public class TaxiPricingDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        System.out.print("请输入行驶里程（公里）: ");
        double distance = scanner.nextDouble();
        
        System.out.print("请输入时间（格式：HH:mm）: ");
        String timeInput = scanner.next();
        
        System.out.print("请输入出租车类型（A/B）: ");
        String taxiType = scanner.next();
        
        try {
            PricingChainManager manager = new PricingChainManager();
            double price = manager.calculatePrice(distance, timeInput, taxiType);
            System.out.println("费用：" + price + "元");
            
        } catch (IllegalArgumentException e) {
            System.err.println("错误：" + e.getMessage());
        } finally {
            scanner.close();
        }
    }
}
